<?php

use App\Admin\Controllers\Shop\WxShopGoodsController;
use Illuminate\Routing\Router;
use Illuminate\Support\Facades\Route;
use Dcat\Admin\Admin;


Admin::routes();

Route::post('admin-api/skuImage', WxShopGoodsController::class . '@skuImage');

Route::group([
    'domain' => config('admin.route.domain'),
    'prefix' => env('APP_ADMIN_PREFIX', 'admin').'/safe',
    'namespace' => config('admin.route.namespace'),
    'middleware' => 'access.token',
], function (Router $router) {
    Route::any('shop/save_goods/{id}', [\App\Admin\Controllers\Shop\WxShopGoodsController::class, 'safe_save']);
    Route::post('shop/add_goods', [\App\Admin\Controllers\Shop\WxShopGoodsController::class, 'safe_add']);
});

Route::group([
    'domain' => config('admin.route.domain'),
    'prefix' => env('APP_ADMIN_PREFIX', 'admin'),
    'namespace' => config('admin.route.namespace'),
    'middleware' => config('admin.route.middleware'),
], function (Router $router) {
    $router->get('/', 'HomeController@index');

    $router->any('files/uploads', 'FileController@handle');
    $router->any('files/ueditor/uploads', 'UeditorUploadController@handler');


    // 配置
    $router->get('settings', 'WxSettingController@index');
    $router->post('settings', 'WxSettingController@index');

    // 基本配置提交
    $router->post('settings/wx', 'WxSettingController@wx');

    // pc配置
    $router->get('settings/pay', 'WxSettingController@index_pay');
    $router->post('settings/pay', 'WxSettingController@index_pay');
    // pc配置提交
    $router->post('settings/action/pay', 'WxSettingController@pay');

    // pc配置
    $router->get('settings/pc', 'WxSettingController@index_pc');
    $router->post('settings/pc', 'WxSettingController@index_pc');
    $router->post('settings/action/pc', 'WxSettingController@pc');

    // 安全配置
    $router->get('settings/safe', 'WxSettingController@index_safe');
    $router->post('settings/safe', 'WxSettingController@index_safe');
    $router->post('settings/action/safe', 'WxSettingController@safe');

    // 安全配置
    $router->get('settings/api', 'WxSettingController@index_api');
    $router->post('settings/api', 'WxSettingController@index_api');
    $router->post('settings/action/api', 'WxSettingController@api');


    // 小程序端
    $router->get('settings/miniprogram', 'WxSettingController@index_miniprogram');
    $router->post('settings/miniprogram', 'WxSettingController@index_miniprogram');
    $router->post('settings/action/miniprogram', 'WxSettingController@miniprogram');

    // app端
    $router->get('settings/app', 'WxSettingController@index_app');
    $router->post('settings/app', 'WxSettingController@index_app');
    $router->post('settings/action/app', 'WxSettingController@app');

    // app端
    $router->get('settings/taoke', 'WxSettingController@index_taoke');
    $router->post('settings/taoke', 'WxSettingController@index_taoke');
    $router->post('settings/action/taoke', 'WxSettingController@taoke');

    // 首页
    $router->get('settings/pageindex', 'WxSettingController@index_pageindex');
    $router->post('settings/pageindex', 'WxSettingController@index_pageindex');
    $router->post('settings/action/pageindex', 'WxSettingController@pageindex');

    // 发现页
    $router->get('settings/pagefind', 'WxSettingController@index_pagefind');
    $router->post('settings/pagefind', 'WxSettingController@index_pagefind');
    $router->post('settings/action/pagefind', 'WxSettingController@pagefind');

    // 搜索页
    $router->get('settings/pagesearch', 'WxSettingController@index_pagesearch');
    $router->post('settings/pagesearch', 'WxSettingController@index_pagesearch');
    $router->post('settings/action/pagesearch', 'WxSettingController@pagesearch');

    // seo配置
    $router->get('settings/seo', 'WxSettingController@index_seo');
    $router->post('settings/seo', 'WxSettingController@index_seo');
    $router->post('settings/action/seo', 'WxSettingController@seo');

    // 活跃配置
    $router->get('settings/robot', 'WxSettingController@index_robot');
    $router->post('settings/robot', 'WxSettingController@index_robot');
    $router->post('settings/action/robot', 'WxSettingController@robot');

    // 发布配置
    $router->get('settings/publish', 'WxSettingController@index_publish');
    $router->post('settings/publish', 'WxSettingController@index_publish');
    $router->post('settings/action/publish', 'WxSettingController@publish');

    // 内容源配置
    $router->get('settings/contents', 'WxSettingController@index_contents');
    $router->post('settings/contents', 'WxSettingController@index_contents');
    $router->post('settings/action/contents', 'WxSettingController@contents');

    // 管理配置
    $router->get('settings/admin', 'WxSettingController@index_admin');
    $router->post('settings/admin', 'WxSettingController@index_admin');
    $router->post('settings/action/admin', 'WxSettingController@admin');

    $router->get('settings/divide', 'WxSettingController@index_divide');
    $router->post('settings/divide', 'WxSettingController@index_divide');
    $router->post('settings/action/divide', 'WxSettingController@divide');

    // 圈子配置
    $router->get('settings/circle', 'WxSettingController@index_circle');
    $router->post('settings/circle', 'WxSettingController@index_circle');
    $router->post('settings/action/circle', 'WxSettingController@circle');

    // 笔记配置
    $router->get('settings/post', 'WxSettingController@index_post');
    $router->post('settings/post', 'WxSettingController@index_post');
    $router->post('settings/action/post', 'WxSettingController@post');

    // 前端代码
    $router->get('settings/front', 'WxSettingController@index_front');
    $router->post('settings/front', 'WxSettingController@index_front');
    $router->post('settings/action/front', 'WxSettingController@front');

    // 广告配置
    $router->get('settings/ad', 'WxSettingController@index_ad');
    $router->post('settings/ad', 'WxSettingController@index_ad');
    $router->post('settings/action/ad', 'WxSettingController@ad');

    $router->get('settings/pagemine', 'WxSettingController@index_pagemine');
    $router->post('settings/pagemine', 'WxSettingController@index_pagemine');
    $router->post('settings/action/pagemine', 'WxSettingController@pagemine');

    $router->get('settings/pagenotice', 'WxSettingController@index_pagenotice');
    $router->post('settings/pagenotice', 'WxSettingController@index_pagenotice');
    $router->post('settings/action/pagenotice', 'WxSettingController@pagenotice');

    $router->get('settings/pagevip', 'WxSettingController@index_pagevip');
    $router->post('settings/pagevip', 'WxSettingController@index_pagevip');
    $router->post('settings/action/pagevip', 'WxSettingController@pagevip');

    $router->get('settings/coin', 'WxSettingController@index_coin');
    $router->post('settings/coin', 'WxSettingController@index_coin');
    $router->post('settings/action/coin', 'WxSettingController@coin');

    $router->get('settings/emoji', 'WxSettingController@index_emoji');
    $router->post('settings/emoji', 'WxSettingController@index_emoji');
    $router->post('settings/action/emoji', 'WxSettingController@emoji');

    $router->get('settings/group_push', 'WxSettingController@index_group_push');
    $router->post('settings/group_push', 'WxSettingController@index_group_push');
    $router->post('settings/action/group_push', 'WxSettingController@group_push');

    // 实时热榜-post配置
    $router->get('realtime/post', 'WxRealtimeController@index_post');
    $router->post('realtime/post', 'WxRealtimeController@index_post');
    $router->post('realtime/action/post', 'WxRealtimeController@post');

    // 实时热榜-topic配置
    $router->get('realtime/topic', 'WxRealtimeController@index_topic');
    $router->post('realtime/topic', 'WxRealtimeController@index_topic');
    $router->post('realtime/action/topic', 'WxRealtimeController@topic');

    // 实时热榜-circle配置
    $router->get('realtime/circle', 'WxRealtimeController@index_circle');
    $router->post('realtime/circle', 'WxRealtimeController@index_circle');
    $router->post('realtime/action/circle', 'WxRealtimeController@circle');

    // 宠物-领养
    $router->get('pets/config', 'Pets\WxPetsController@index_config');
    $router->post('pets/config', 'Pets\WxPetsController@index_config');
    $router->post('pets/action/config', 'Pets\WxPetsController@config');

    $router->get('used/config', 'Used\WxUsedController@index_config');
    $router->post('used/config', 'Used\WxUsedController@index_config');
    $router->post('used/action/config', 'Used\WxUsedController@config');

    $router->get('note/config', 'Note\WxNoteController@index_config');
    $router->post('note/config', 'Note\WxNoteController@index_config');
    $router->post('note/action/config', 'Note\WxNoteController@config');

    $router->get('voter/config', 'Voter\WxVoterCommonController@index_config');
    $router->post('voter/config', 'Voter\WxVoterCommonController@index_config');
    $router->post('voter/action/config', 'Voter\WxVoterCommonController@config');

    $router->get('bureau/config', 'Bureau\WxBureauCommonController@index_config');
    $router->post('bureau/config', 'Bureau\WxBureauCommonController@index_config');
    $router->post('bureau/action/config', 'Bureau\WxBureauCommonController@config');

    // 抽奖系统-转盘
    $router->get('luckdraw/config', 'LuckDraw\WxLuckDrawController@index_config');
    $router->post('luckdraw/config', 'LuckDraw\WxLuckDrawController@index_config');
    $router->post('luckdraw/action/config', 'LuckDraw\WxLuckDrawController@config');

    // 用户抽奖
    $router->resource('luckdraw/record', 'User\WxUserLuckDrawRecordController');

    // 实时热榜-user配置
    $router->get('realtime/user', 'WxRealtimeController@index_user');
    $router->post('realtime/user', 'WxRealtimeController@index_user');
    $router->post('realtime/action/user', 'WxRealtimeController@user');

    // 分销系统-配置
    $router->get('invite_benefit/config', 'Invite\WxInviteCommonController@index_userinvite');
    $router->post('invite_benefit/config', 'Invite\WxInviteCommonController@index_userinvite');
    $router->post('invite_benefit/action/config', 'Invite\WxInviteCommonController@userinvite');

    $router->get('invite_benefit/itc_bg_config', 'Invite\WxInviteCommonController@index_userinvite_itc_bg');
    $router->post('invite_benefit/itc_bg_config', 'Invite\WxInviteCommonController@index_userinvite_itc_bg');
    $router->post('invite_benefit/action/itc_bg_config', 'Invite\WxInviteCommonController@userinvite_itc_bg');
    $router->get('invite_benefit/action/itc_bg_config_test', 'Invite\WxInviteCommonController@userinvite_itc_bg_test');

    // 头像框-配置
    $router->get('avatar_frame/config', 'WxSettingController@index_avatarframe');
    $router->post('avatar_frame/config', 'WxSettingController@index_avatarframe');
    $router->post('avatar_frame/action/config', 'WxSettingController@avatarframe');

    $router->get('settings/shop', 'WxSettingController@index_shop');
    $router->post('settings/shop', 'WxSettingController@index_shop');
    $router->post('settings/action/shop', 'WxSettingController@shop');

    // 上传设置
    $router->get('settings/oss', 'WxSettingController@oss');
    $router->post('settings/oss', 'WxSettingController@oss');
    // 附件
    $router->resource('attachment', 'WxAttachmentController');
    //回复反馈
//    $router->post('settings','WxSettingController@index');
    $router->resource('/tenants', 'WxTenantController');

    $router->resource('/universities', 'WxUniversityController');

    // 轮播图
    $router->resource('slideshow', 'WxSlideshowController');
    // 用户
    $router->resource('users', 'User\WxUserController');
    // 圈子
    $router->resource('circle', 'Circle\WxCircleController');
    // 板块
    $router->resource('plate', 'WxPlateController');
    // 图集
    $router->resource('wallpaper/item', 'WxWallpaperController');
    // 图集主题
    $router->resource('wallpaper/subject', 'WxWallpapersSubjectController');
    // 发文章
    $router->resource('posts/publish', 'Posts\WxPostPublishController');
    // 发文章->分步表单验证
    $router->resource('posts/publish/step', 'Posts\WxPostPublishController');
    // 文章
    $router->resource('posts/index', 'Posts\WxPostController');
    $router->resource('posts/comment/manual', 'Posts\WxPostsCommentManualController');
    // 搜索记录
    $router->resource('search', 'WxSearchController');
    // 用户反馈
    $router->resource('feedback', 'WxFeedbackController');
    // 通知
    $router->resource('notice', 'WxNoticeController');
    // 认证
    $router->resource('authentication', 'WxAuthenticationController');
    // 条款
    $router->resource('clause', 'WxClauseController');
    // 问答
    $router->resource('qa/question', 'WxQuestionController');
    // 条款
    $router->resource('activity', 'WxActivityController');
    // 页面事件
    $router->resource('page_event', 'WxPageEventController');
    // 人机验证
    $router->resource('captcha_img', 'WxCaptchaImgController');
    // 评论
    $router->resource('commen', 'Posts\WxCommentController');
    // 用户资料
    $router->resource('usertemp', 'User\WxUserTempController');
    // 话题
    $router->resource('tags', 'Posts\WxTagController');
    // 投票
    $router->resource('vote', 'Posts\WxPostsVoteController');
    // 私信
    $router->resource('chats', 'WxChatController');
    // 付费内容
    $router->resource('posts/paycontent', 'Posts\WxPostsPayContentController');
    // 用户投票
    $router->resource('user/vote', 'User\WxUserVoteController');
    // 用户签到
    $router->resource('user/sign', 'User\WxUserSignRecordController');
    // 用户举报
    $router->resource('user/report', 'User\WxUserReportController');
    // 学生认证
    $router->resource('user/student_certify', 'User\WxUserStudentCertifyController');
    // 订单
    $router->resource('order', 'WxOrderController');
    // 充电
    $router->resource('exceptional', 'WxExceptionalController');
    // 用户金融
    $router->resource('financial', 'User\WxUserFinancialController');
    // 用户硬币记录
    $router->resource('coin/record', 'User\WxUserCoinRecordController');
    // 用户提现
    $router->resource('withdrawal', 'User\WxUserWithdrawalController');

    // SHOP
    // SHOP分类
    $router->resource('shop/classifys', 'Shop\WxShopClassifysController');
    $router->resource('shop/classify', 'Shop\WxShopClassifyController');
    // SHOP商品
    $router->resource('shop/goods', 'Shop\WxShopGoodsController');
    // SHOP购物袋
    $router->resource('shop/cart', 'Shop\WxShopCartController');
    // SHOP订单
    $router->resource('shop/order', 'Shop\WxShopOrderController');
    // SHOP订单商品
    $router->resource('shop/orderGoods', 'Shop\WxShopOrderGoodsController');
    // SHOP订单售后
    $router->resource('shop/orderAfter', 'Shop\WxShopOrderAfterController');
    // SHOP退款
    $router->resource('shop/refund', 'Shop\WxShopRefundController');
    // SHOP收货地址
    $router->resource('shop/address', 'Shop\WxShopAddressController');
    // SHOP服务
    $router->resource('shop/service', 'Shop\WxShopServiceController');
    // SHOP通知
    $router->resource('shop/notice', 'Shop\WxShopNoticeController');
    // SHOP保证金
    $router->resource('shop/guarantee', 'Shop\WxShopGuaranteeRecordController');
    // SHOP经营地址
    $router->resource('shop/contact', 'Shop\WxShopContactController');
    // SHOP经营地址
    $router->resource('shop/coupon', 'Shop\WxShopCouponController');
    // SHOP店铺
    $router->resource('shops', 'Shop\WxShopController');
    //商品Fun
    Route::any('shop/save_goods/{id}', [\App\Admin\Controllers\Shop\WxShopGoodsController::class, 'save']);
    Route::post('shop/add_goods', [\App\Admin\Controllers\Shop\WxShopGoodsController::class, 'add']);

    // 任务管理
    $router->resource('tasks/day', 'WxDayTaskController');
    // 任务管理
    $router->resource('tasks/once', 'WxOnceTaskController');
    // 图集主题
    $router->resource('user/task', 'User\WxUserTaskController');

    // 图标
    $router->resource('settings/icons', 'WxIconController');
    // 页面模板
    $router->resource('pages', 'WxPageController');

    // 宠物相关
    $router->resource('pets/adoption/index', 'Pets\WxPetsAdoptionController');
    $router->resource('pets/adoption/apply', 'Pets\WxPetsAdoptionApplyController');
    $router->resource('pets/comment', 'Pets\WxPetsCommentController');

    // 闲置
    $router->resource('used/good', 'Used\WxUsedGoodController');
    $router->resource('used/comment', 'Used\WxUsedCommentController');
    $router->resource('used/classify', 'Used\WxUsedClassifyController');
    $router->resource('used/refund', 'Used\WxUsedRefundController');
    $router->resource('used/orderGoods', 'Used\WxUsedOrderGoodsController');

    // 恋爱纸条

    // 选票
    $router->resource('voter/template', 'Voter\WxVoterTemplateController');
    $router->resource('voters', 'Voter\WxVoterController');
    $router->resource('voter/player', 'Voter\WxVoterPlayerController');

    // 组局
    $router->resource('clubs', 'Bureau\WxClubController');
    $router->resource('bureau/list', 'Bureau\WxBureauController');
    $router->resource('bureau/comment', 'Bureau\WxBureauCommentController');
    $router->resource('bureau/orderGoods', 'Bureau\WxBureauOrderGoodsController');
    $router->resource('bureau/refund', 'Bureau\WxBureauRefundController');


    // PC端
    // 全局菜单
    $router->resource('settings/menu', 'WxMenuController');
    // 导航栏板块管理
    $router->resource('settings/navigation/plate', 'WxNavigationPlateController');
    // 导航栏管理
    $router->resource('settings/navigation', 'WxNavigationController');

    $router->resource('/extension', 'WxExtensionController');

    $router->resource('/circle_tag', 'Circle\WxCircleTagController');

    $router->resource('/invite_benefit/record', 'User\WxUserInviteBenefitRecordController');
    $router->resource('/invite_benefit/tmp_code', 'User\WxUserInviteTempCodeController');

    $router->resource('/avatar_frame/frame', 'User\WxUserAvatarFrameController');
    $router->resource('/avatar_frame/purchase', 'User\WxUserAvatarFramePurchaseController');

    $router->resource('collecter/collected', 'Collecter\MiniCollecterCollectedController');
    $router->resource('collecter/user_map', 'Collecter\MiniCollecterUserMapController');

    $router->resource('/mp_free_publish', 'Mp\WxMpFreePublishController');
    $router->resource('/mp_custom_menu', 'Mp\WxMpCustomMenuController');
    $router->resource('/mp_message', 'Mp\WxMpMessageController');
    $router->resource('/mp_material', 'Mp\WxMpMaterialController');
    $router->resource('/mp_message_reply', 'Mp\WxMpMessageReplyController');

    Route::get('auth/operation-logs', 'System\AdminLogController@index')->name('dcat-admin.operation-log.index');
    Route::delete('auth/operation-logs/{id}', 'System\AdminLogController@destroy')->name('dcat-admin.operation-log.destroy');

    // 选项搜索
    $router->get('/select/users', 'User\WxUserController@users');
    $router->get('/select/tags', 'Posts\WxTagController@tags');
    $router->get('/select/shop/goods', 'Shop\WxShopGoodsController@goods');
    $router->get('/select/posts/address', 'Posts\WxPostsAddressController@address');
    $router->get('/select/voters', 'Voter\WxVoterController@voters');
    $router->get('/select/shops', 'Shop\WxShopController@shops');
    $router->get('/select/universities', 'WxUniversityController@universities');
    $router->get('/mp/free_publish/select', 'Mp\WxMpFreePublishController@free_publish_select');

    // 后台搜索功能
    Route::post('/search', 'System\AdminSearchController@search');
    Route::post('/clear', 'System\AdminSearchController@clear');
    Route::get('/front/uniapp', 'System\AdminFrontController@uniapp');
    Route::get('/front/desai/pc', 'System\AdminFrontController@desai_pc');

    Route::any('/front/pagejson', 'System\AdminFrontController@pagejson');
    Route::any('/front/uniscss', 'System\AdminFrontController@uniscss');
    Route::any('/front/manifestjson', 'System\AdminFrontController@manifestjson');

    $router->get('domain/auth', 'WxDomainAuthController@appCenter');

    $router->get('admin/tools', 'Admin\AdminToolsController@tools');
    $router->get('admin/tools/img_domain_replace', 'Admin\AdminToolsController@imgDomainReplaceForm');
    $router->post('admin/tools/img_domain_replace', 'Admin\AdminToolsController@imgDomainReplaceHandler');

    $router->get('admin/tools/chat_record_change', 'Admin\AdminToolsController@chatRecordChangeForm');
    $router->post('admin/tools/chat_record_change', 'Admin\AdminToolsController@chatRecordChangeHandler');

    $router->resource('mini/admin/menu_search', 'AdminMenuSearchController');
    $router->resource('mini/admin/domain_auth', 'WxDomainAuthController');
    $router->resource('zodiac-signs', ZodiacSignController::class);
    $router->resource('weekly-horoscopes', WeeklyHoroscopeController::class);
});